package semant.first_pass;

import errors.ErrorEchoer;
import semant.Env;
import syntaxtree.Program;
import syntaxtree.VisitorAdapter;

public class ProgramHandler extends VisitorAdapter {

	private Env result;

	private ProgramHandler(ErrorEchoer e) {
		super();
		result = new Env(e);
	}

	public static Env firstPass(ErrorEchoer e, Program node) {
		ProgramHandler p = new ProgramHandler(e);
		node.accept(p);
		return p.result;
	}

	@Override
	public void visit(Program node) {
		MainClasslHandler.firstPass(result, node.mainClass);
		ClassDeclListHandler.firstPass(result, node.classList);
	}

}
